#pragma once

//#include "cg/cggl.h"
#include <cg/cgGL.h>
#include <string>
#include <vector>

#pragma comment(lib,"cg.lib")
#pragma comment(lib,"cgGL.lib")

typedef enum
 {
	 CG_GL_MODELVIEW_MTX,
	 CG_GL_MODELVIEW_PROJECTION_MTX,
	 CG_GL_MODELVIEW_IT_MTX,
	 CG_GL_ARBITRARY_MTX,
	 CG_GL_VECTOR_1D,
	 CG_GL_VECTOR_2D,
	 CG_GL_VECTOR_3D,
	 CG_GL_VECTOR_4D,
	 CG_GL_TEXTURE_2D,
	 CG_GL_TEXTURE_RECT,
	 CG_GL_TEXTURE_CUBE_MAP,
	 CG_GL_VECTOR_4D_ARRAY,
 } CGGL_PARAMETER_TYPE2;

using namespace std;

class c_shader_parameter
{
public:
	CGparameter	m_cgp;
	string		m_binding_name;
	void		*m_ptrs;
	CGGL_PARAMETER_TYPE2 type;
};

class ShaderHandler
{
public:
	ShaderHandler(void);
	~ShaderHandler(void);

	string	m_filename;

	CGGLenum m_type;			// CG_GL_VERTEX or CG_GL_FRAGMENT

	CGcontext					m_context;
	CGprogram					m_program;
	CGprofile					m_profile;

	std::vector<c_shader_parameter>	m_parameters;

	void	SetShaderType(CGGLenum shader_type);
	
	bool	Load(const char *filename, CGGLenum type);
	void	Unload();
	void	AddParameter(char *binding_name, CGGL_PARAMETER_TYPE2 type, void *ptr);
	void	RefreshParameter();

	void	bind();
	void	release();

private:
};
